// pages/user/user.js
import { request } from "../../request/index.js";
import { showModal, showToast, uploadFile, chooseImage, showLoading } from "../../util/AsyncWx.js";
var app = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
    user: [],
    id: '',
    MyCollectedGoods: [],

  },
  async onShow() {
    var that = this;
    var userInfo = wx.getStorageSync("userInfo");
    that.setData({
      user: userInfo,
      id: app.globalData.uid
    })
    var id = that.data.id
    var uid = that.data.id
    const res = await request({ url: "/collecttopic/getCollectTopicByUid", data: { uid } })
    that.setData({
      MyCollectedTopic: res
    })
    wx.setStorageSync("MyCollectedTopic", res);
    const result = await request({ url: "/collectgoods/getAllCollectGoods", data: { id } })
    that.setData({
      MyCollectedGoods: result
    })
    wx.setStorageSync("MyCollectedGoods", result);
  }

})